package io.terminus.spzx.product.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.terminus.spzx.model.entity.product.Category;
import io.terminus.spzx.model.vo.common.Result;
import io.terminus.spzx.model.vo.common.ResultCodeEnum;
import io.terminus.spzx.product.service.CategoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author lichunlong lcl253137@alibaba-inc.com
 * @Desc 移动端分类管理Controller
 * @Date 2024-10-24
 */
@RestController
@Tag(name = "分类接口管理")
@RequiredArgsConstructor
@RequestMapping(value = "/api/product/category")
public class CategoryController {

    private final CategoryService categoryService;

    @GetMapping("findCategoryTree")
    @Operation(summary = "获取分类树形数据")
    public Result<List<Category>> findCategoryTree() {
        List<Category> list = categoryService.findCategoryTree();

        return Result.build(list, ResultCodeEnum.SUCCESS);
    }
}
